/*
 * Metaverse Core
 * Copyright (C) 2010 Vyacheslav Vorobyov, All rights reserved.
 * See LICENSE for full license information.
 */
package org.metaverse.warehouse.com.util;

import java.util.LinkedHashMap;
import java.util.Map;

import org.metaverse.warehouse.Senary.Slot;
import org.metaverse.warehouse.com.Constraint;
import org.metaverse.warehouse.com.ValueConstraint;

/**
 * @author vjache
 *
 */
public class ConstraintImpl implements Constraint {
	
	private ValueConstraint _subject;
	private ValueConstraint _predicate;
	private ValueConstraint _object;
	private ValueConstraint _context;
	private ValueConstraint _user;
	private ValueConstraint _lastAssertTime;
	
	/**
	 * 
	 */
	public ConstraintImpl() {}

	/**
	 * @param subject the subject to set
	 */
	public void setSubject(ValueConstraint subject) {
		_subject = subject;
	}

	/* (non-Javadoc)
	 * @see org.metaverse.warehouse.rdf.Senary#getSubject()
	 */
	public ValueConstraint getSubject() {
		return _subject;
	}

	/**
	 * @param predicate the predicate to set
	 */
	public void setPredicate(ValueConstraint predicate) {
		_predicate = predicate;
	}

	/* (non-Javadoc)
	 * @see org.metaverse.warehouse.rdf.Senary#getPredicate()
	 */
	public ValueConstraint getPredicate() {
		return _predicate;
	}

	/**
	 * @param object the object to set
	 */
	public void setObject(ValueConstraint object) {
		_object = object;
	}

	/* (non-Javadoc)
	 * @see org.metaverse.warehouse.rdf.Senary#getObject()
	 */
	public ValueConstraint getObject() {
		return _object;
	}

	/**
	 * @param context the context to set
	 */
	public void setContext(ValueConstraint context) {
		_context = context;
	}

	/* (non-Javadoc)
	 * @see org.metaverse.warehouse.rdf.Senary#getContext()
	 */
	public ValueConstraint getContext() {
		return _context;
	}

	/**
	 * @param lastAssertTime the lastAssertTime to set
	 */
	public void setLastAssertTime(ValueConstraint lastAssertTime) {
		_lastAssertTime = lastAssertTime;
	}

	/* (non-Javadoc)
	 * @see org.metaverse.warehouse.rdf.Senary#getLastAssertTime()
	 */
	public ValueConstraint getLastAssertTime() {
		return _lastAssertTime;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(ValueConstraint user) {
		_user = user;
	}

	/* (non-Javadoc)
	 * @see org.metaverse.warehouse.rdf.Senary#getUser()
	 */
	public ValueConstraint getUser() {
		return _user;
	}

	@Override
	public Map<Slot, ValueConstraint> getAll() {
		LinkedHashMap<Slot, ValueConstraint> map = new LinkedHashMap<Slot, ValueConstraint>(6);
		map.put(Slot.Subject, _subject);
		map.put(Slot.Predicate, _predicate);
		map.put(Slot.Object, _object);
		map.put(Slot.Context, _context);
		map.put(Slot.User, _user);
		map.put(Slot.LastAssertTime, _lastAssertTime);
		return map;
	}
	
}
